<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php
        //CONTROLLER
        require('./_app/Config.inc.php');

        //MODEL
        $read = new Read;
        $read->ExeRead('ws_categories');
        $tpl = file_get_contents('_mvc/category.tpl.html');
        var_dump($tpl);

        foreach ($read->getResult() as $cat):
            extract($cat);
            //var_dump($cat);
            //VIEW
            //require('./_mvc/category.php');
            //echo str_replace(array('#category_title#','#category_content#'), array($category_title, $category_content), $tpl);
            //EXPLODE TRANSFORMA STRING EM ARRAY
            //IMPLODE JUNTA ELEMENTOS DE UM ARRAY EM UMA STRING
            //STR_REPLACE PEGA O VALOR DE CADA ARRAY E OS USA PARA FAZER PESQUISA E A SUBSTITUICAO 
            $cat['pubdate'] = date('d/m/Y', strtotime($cat['category_date']));
            $cat['category_date'] = date('d/m/Y H;i', strtotime($cat['category_date'])) . 'hs';
            $links = explode('&','#' . implode("#&#", array_keys($cat)) . '#');
            echo str_replace($links, array_values($cat), $tpl);
            
            //ENDVIEW
        endforeach;
        //ENDMODEL
        ?>
    </body>
</html>
